/* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. */

package v1

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VnfDesc is the Schema for the Vnf deployment API
type VnfDesc struct {
	metav1.TypeMeta `json:",inline"`

	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              VnfDescSpec   `json:"spec,omitempty"`
	Status            VnfDescStatus `json:"status,omitempty"`
}

// VnfDescSpec
type VnfDescSpec struct {
	InterfaceVersion string     `json:"interface_version"`
	VnfInfo          VnfInfo    `json:"vnfInfo"`
	VnfUri           []VnfUri   `json:"vnfUri"`
	SftpInfo         SftpInfo   `json:"sftpInfo,omitempty"`
	Packages         []Packages `json:"packages,omitempty"`
	IsUploadProgress bool       `json:"isUploadProgress"`
	ReleaseList      []string   `json:"releaseList"`
}

// VnfInfo for vnf basic info
type VnfInfo struct {
	VnfID      string `json:"vnfID"`
	VnfName    string `json:"vnfName"`
	VnfType    string `json:"vnfType"`
	VnfVersion string `json:"vnfVersion"`
	Vendor     string `json:"vendor"`
}

// VnfUri vnf request
type VnfUri struct {
	UriType      string `json:"uriType"`
	Uri          string `json:"uri"`
	HttpMethod   string `json:"httpMethod"`
	KeyValueList string `json:"keyValueList"`
}

// SftpInfo for ftp info
type SftpInfo struct {
	IpV4     string `json:"ipV4"`
	IpV6     string `json:"ipV6"`
	Port     int    `json:"port"`
	Protocol string `json:"protocol"`
	UserName string `json:"username"`
	PassWord string `json:"password"`
}

// Packages for package info
type Packages struct {
	PkgName    string `json:"pkgName"`
	PkgType    string `json:"pkgType"`
	PkgVersion string `json:"pkgVersion"`
	Vendor     string `json:"vendor"`
}

// VnfDescStatus
type VnfDescStatus struct {
	VnfDeployInstanceStatus string `json:"vnfDeployInstanceStatus"`
	VnfDeployTaskStatus     string `json:"vnfDeployTaskStatus"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VnfDescList contains a list of VnfDesc
type VnfDescList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []VnfDesc `json:"items"`
}
